 
#include "My_AVLTree.h"

void test1()
{
	AVLTree<int, int> a1;
	a1.Insert(make_pair(10,10));
	a1.Insert(make_pair(8, 8));
	a1.Insert(make_pair(11, 11));
	a1.print_tree();

	a1.Insert(make_pair(6, 6));
	//a1.Insert(make_pair(9, 9));
	a1.Insert(make_pair(5, 5));

	a1.print_tree();
	cout << a1.IsBalance() << endl;
}
void test2()
{
	AVLTree<int, int> a2;
	a2.Insert(make_pair(7, 7));
	a2.Insert(make_pair(5, 5));
	a2.Insert(make_pair(9, 9));
	a2.print_tree();

	//a2.Insert(make_pair(8, 8));
	a2.Insert(make_pair(10, 10));
	a2.Insert(make_pair(12, 12));
	a2.print_tree();
	cout << a2.IsBalance() << endl;
}

void test3()
{
	int arr1[] = {5,4,3,2,1,0};
	int arr2[] = {16,3,7,11,9,26,18,14,15};
	int arr3[] = {4,2,6,1,3,5,15,7,16,14};
	AVLTree<int, int> a3;
	for (size_t i = 0; i < sizeof(arr3) / sizeof(arr3[0]); i++)
	{
		a3.Insert(make_pair(arr3[i],arr3[i]));
	}
	a3.print_tree();
}

void test4()
{
	int arr1[] = { 5, 4, 3, 2, 1, 0 };
	int arr2[] = { 16, 3, 7, 11, 9, 26, 18, 14, 15 };
	int arr3[] = { 4, 2, 6, 1, 3, 5, 15, 7, 16, 14 };
	AVLTree<int, int> a4;
	for (size_t i = 0; i < sizeof(arr2) / sizeof(arr2[0]); i++)
	{
		a4.Insert(make_pair(arr2[i], arr2[i]));
	}
	a4.print_tree();
	cout << endl;
	cout << a4.IsBalance() << endl;;
}
int main()
{
	//test1();
	//test2();
	//test3();
	test4();
	return 0;
}